//
//  SWChooseProvienceViewController.m
//  sc-cyan-ios
//
//  Created by lvjian01 on 2017/12/26.
//  Copyright © 2017年 greenbuilding. All rights reserved.
//

#import "SWChooseProvienceViewController.h"
#import "SWSearchBar.h"

@interface SWChooseProvienceViewController ()<UITableViewDelegate,UITableViewDataSource>

@property (weak, nonatomic) IBOutlet UIView *searchView;
@property (weak, nonatomic) IBOutlet UITableView *provienceTableView;

@property (nonatomic, strong) SWSearchBar *searchBar;
@end

@implementation SWChooseProvienceViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    if (!self.title || [self.title isEqualToString:@""]) {
        self.title = @"城市定位";
    }
    // Do any additional setup after loading the view.
    [self.searchView addSubview:self.searchBar];
//    [self.searchBar mas_makeConstraints:^(MASConstraintMaker *make) {
//        make.edges.equalTo(self.searchView).with.insets(UIEdgeInsetsMake(10, 10, 10, 10));
//    }];
    
    
}

- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

- (SWSearchBar *)searchBar{
    if (!_searchBar) {
        _searchBar = [[SWSearchBar alloc] initWithFrame:CGRectMake(10, 10, Main_Screen_Width-20, 35) searchBarStyle:SWSearchBarStyleDefault];
        _searchBar.placeholder = @"搜索";
        _searchBar.textBackgroudColor = [UIColor clearColor];
        _searchBar.barBackgroudColor = [UIColor clearColor];
        _searchBar.placeholderColor = UIColorFromRGB(0x999999);
        _searchBar.textColor = UIColorFromRGB(0x4D4D4D);
        _searchBar.tintColor = UIColorFromRGB(0x4D4D4D);
        _searchBar.placeholderFontSize = 13;
        _searchBar.textFontSize = 13;
//        _searchBar.textBordStyle = SWTextBorderStyleRoundRect;
//        _searchBar.layer.cornerRadius = 17.5;
        _searchBar.layer.borderWidth = 0.5;
        _searchBar.layer.borderColor = UIColorFromRGB(0xD4D4D4).CGColor;
        _searchBar.backgroundColor = UIColorFromRGB(0xF5F5F5);
        
        [_searchBar searchBarTextSearchTextBlock:^(NSString *searchText) {
            NSLog(@"%@",searchText);
        }];


        
//        这里设置搜索框的各种样式
    }
    return _searchBar;
}

#pragma mark -- tableview delegate

#pragma mark -- tableview datasource

- (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView{
    return 10;
}

- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section{
    return 3;
}

- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath{
    UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:@"choosePovience" forIndexPath:indexPath];
    
//    cell.textLabel.alignmentRectInsets = UIEdgeInsetsMake(0, 10, 0, 10);
    
    
    return cell;
}

- (CGFloat)tableView:(UITableView *)tableView heightForFooterInSection:(NSInteger)section{
    return 0.0001;
}

- (CGFloat)tableView:(UITableView *)tableView heightForHeaderInSection:(NSInteger)section{
    return 25;
}



/*
#pragma mark - Navigation

// In a storyboard-based application, you will often want to do a little preparation before navigation
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
    // Get the new view controller using [segue destinationViewController].
    // Pass the selected object to the new view controller.
}
*/

@end
